
[dbo].[RecurringDonationExpectedPayment]
CREATE TABLE [dbo].[RecurringDonationExpectedPayment]
(
[RecurringDonationExpectedPaymentKey] [uniqueidentifier] NOT NULL,
[RecurringDonationExpectedPaymentSetKey] [uniqueidentifier] NOT NULL,
[RecurringDonationCommitmentKey] [uniqueidentifier] NOT NULL,
[OpportunityKey] [uniqueidentifier] NULL,
[DonationAmount] [decimal] (18, 4) NOT NULL,
[PaymentMethod] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Distribution] [varchar] (31) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Appeal] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Campaign] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Fund] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Narrative] [nvarchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL CONSTRAINT [DF_RecurringDonationExpectedPayment_Narrative] DEFAULT (''),
[MatchReference] [nvarchar] (18) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[BranchSortCode] [nvarchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[BankAccountNumber] [nvarchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[BankAccountName] [nvarchar] (18) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ResultingTransNum] [int] NOT NULL CONSTRAINT [DF_RecurringDonationExpectedPayment_ResultingTransNum] DEFAULT ((0)),
[ResultingTransLineNum] [int] NOT NULL CONSTRAINT [DF_RecurringDonationExpectedPayment_ResultingTransLineNum] DEFAULT ((0)),
[RecurringDonationExpectedPaymentStatusCode] [smallint] NOT NULL,
[CreatedByUserKey] [uniqueidentifier] NOT NULL,
[CreatedOn] [datetime] NOT NULL CONSTRAINT [DF_RecurringDonationExpectedPayment_CreatedOn] DEFAULT (getdate()),
[UpdatedByUserKey] [uniqueidentifier] NOT NULL,
[UpdatedOn] [datetime] NOT NULL CONSTRAINT [DF_RecurringDonationExpectedPayment_UpdatedOn] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RecurringDonationExpectedPayment] ADD CONSTRAINT [PK_RecurringDonationExpectedPayment] PRIMARY KEY CLUSTERED ([RecurringDonationExpectedPaymentKey]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RecurringDonationExpectedPayment] ADD CONSTRAINT [FK_RecurringDonationExpectedPayment_OpportunityMain] FOREIGN KEY ([OpportunityKey]) REFERENCES [dbo].[OpportunityMain] ([OpportunityKey])
GO
ALTER TABLE [dbo].[RecurringDonationExpectedPayment] ADD CONSTRAINT [FK_RecurringDonationExpectedPayment_RecurringDonationCommitment] FOREIGN KEY ([RecurringDonationCommitmentKey]) REFERENCES [dbo].[RecurringDonationCommitment] ([RecurringDonationCommitmentKey])
GO
ALTER TABLE [dbo].[RecurringDonationExpectedPayment] ADD CONSTRAINT [FK_RecurringDonationExpectedPayment_RecurringDonationExpectedPaymentSet] FOREIGN KEY ([RecurringDonationExpectedPaymentSetKey]) REFERENCES [dbo].[RecurringDonationExpectedPaymentSet] ([RecurringDonationExpectedPaymentSetKey])
GO
ALTER TABLE [dbo].[RecurringDonationExpectedPayment] ADD CONSTRAINT [FK_RecurringDonationExpectedPayment_RecurringDonationExpectedPaymentStatusRef] FOREIGN KEY ([RecurringDonationExpectedPaymentStatusCode]) REFERENCES [dbo].[RecurringDonationExpectedPaymentStatusRef] ([RecurringDonationExpectedPaymentStatusCode])
GO
ALTER TABLE [dbo].[RecurringDonationExpectedPayment] ADD CONSTRAINT [FK_RecurringDonationExpectedPayment_UserMain_CreatedBy] FOREIGN KEY ([CreatedByUserKey]) REFERENCES [dbo].[UserMain] ([UserKey])
GO
ALTER TABLE [dbo].[RecurringDonationExpectedPayment] ADD CONSTRAINT [FK_RecurringDonationExpectedPayment_UserMain_UpdatedBy] FOREIGN KEY ([UpdatedByUserKey]) REFERENCES [dbo].[UserMain] ([UserKey])
GO
GRANT REFERENCES ON [dbo].[RecurringDonationExpectedPayment] TO [IMIS]
GRANT SELECT ON [dbo].[RecurringDonationExpectedPayment] TO [IMIS]
GRANT INSERT ON [dbo].[RecurringDonationExpectedPayment] TO [IMIS]
GRANT DELETE ON [dbo].[RecurringDonationExpectedPayment] TO [IMIS]
GRANT UPDATE ON [dbo].[RecurringDonationExpectedPayment] TO [IMIS]
GO